<?php

namespace Modules\Admin\Models;

use DateTimeInterface;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class AuthAdmin extends Authenticatable implements JWTSubject
{
    use Notifiable;

    protected $guard = 'auth_admin';
    protected $hidden = [
        'password'
    ];


    public function getJWTIdentifier()
    {
        return $this->getKey();
    }


    public function getJWTCustomClaims()
    {
        return [];
    }


    public function getUpdatedAtAttribute($value)
    {
        return $value ? $value : '';
    }


    public function auth_groups()
    {
        return $this->belongsTo('Modules\Admin\Models\AuthGroup', 'group_id', 'id');
    }


    public function auth_projects()
    {
        return $this->belongsTo('Modules\Admin\Models\AuthProject', 'project_id', 'id');
    }


    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
}
